#ifndef LIB_TWCORE_INTERNAL_TOASTGENERATOR_H_
#define LIB_TWCORE_INTERNAL_TOASTGENERATOR_H_

#include "Toast.h"
#include <QWidget>
#include <QList>
#include <QMap>

namespace TWCore
{
	class ToastGenerator : public QObject
	{
		Q_OBJECT
		Q_DISABLE_COPY(ToastGenerator)
		public:
			ToastGenerator();
			~ToastGenerator();
			void setToastParent(QWidget* w){m_toastParent = w;}
			void makeToast(QString msg,int x,int y,int duration,int index);
		private:
			struct PendingToast
			{
				QString msg;
				int x;
				int y;
				int duration;
			};

			QWidget* m_toastParent;

			// If the value is true,then the ToastWidget is using.
			QMap<int,bool> m_toastIsUsingMap;
			QMap<int,Toast*> m_toasts;
			QMap<int,QList<PendingToast*>* > m_pendingToasts;
		private slots:
			void toastNext(int index);
	};

}

#endif /* LIB_TWCORE_INTERNAL_TOASTGENERATOR_H_ */
